#!/usr/bin/env python

import web
from grabbers import aflgrabber

urls = (
    "/", "index",
    "/afl/(.*)", "afl"
)

app = web.application(urls, globals())

class index:
    def GET(self):
        return "Nothing to see here..."

class afl:
    def GET(self, teams_s):
        teams_s = teams_s.replace("/", "")
        if len(teams_s) < 3:
            return "Please submit a team name" 
        teams = teams_s.split(',')
        if len(teams) > 0:
            r = ""
            for t in teams:
                r += "%s\n" % ",".join(afl-grabber.get_score(t))

            return r

        else:
            return "Please enter pass a team name."

# start running the server
if __name__ == "__main__": app.run()
